package client;



import service.UserService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/delSelectedServlet")
public class DelSelectedServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //1.获取所有id存储为ids数组
        String[] ids = request.getParameterValues("uid");
        //2.创建UserService对象，
        UserService service = new UserService();
        //调用service层删除多条数据的方法
        service.delSelectedUser(ids);
        //3.重定向跳转到查询所有Servlet
        response.sendRedirect(request.getContextPath()+"/listUser");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
